<template>
  <el-card>
    <VisitorPie :pieData="pieData"></VisitorPie>
  </el-card>
</template>

<script>
import VisitorPie from '../components/VisitorPie'
import { getUserCity } from '../api/index'
export default {
  components: { VisitorPie },
  data() {
    return {
      pieData: []
    }
  },
  created() {
    this.initData()
  },
  methods: {
    async initData() {
      try {
        const { data: res } = await getUserCity()
        if (res.status === 1) {
          this.pieData = res.user_city
        } else {
          throw new Error(res)
        }
      } catch (error) {
        console.log(error)
      }
    }
  }
}
</script>

<style></style>
